/**
 * Project Name:socket
 * File Name:SocketCommuException.java
 * Package Name:com.aeye.mbr.socket.factory
 * Date:2015年11月6日下午11:24:23
 * Copyright (c) 2015, shengpeng@a-eye.cn All Rights Reserved.
 *
*/

package com.aeye.mbr.common.exception;


import com.aeye.mbr.common.base.constants.ErrorCodeConstants;


/**
 * ClassName:AlgorithmCommuException <br/>
 * Function: 算法通讯异常<br/>
 * Date:     2015年11月6日 下午11:24:23 <br/>
 * @author   shengpeng
 * @version  
 * @since    JDK 1.6
 * @see 	 
 */
public class AlgorithmCommuException extends Exception{

	/**
	 * serialVersionUID:TODO(用一句话描述这个变量表示什么 )by shengpeng.
	 * @since JDK 1.6
	 */
	private static final long serialVersionUID = 1L;

	private ErrorCodeConstants ec;
	private String causeStr;
	
	public ErrorCodeConstants getEc() {
		return ec;
	}
	public void setEc(ErrorCodeConstants ec) {
		this.ec = ec;
	}

	public AlgorithmCommuException(ErrorCodeConstants ec)
	{
		this.ec = ec;
	}
	
	public AlgorithmCommuException(ErrorCodeConstants sec,String cause)
	{
		this.ec = sec;
		this.causeStr = cause;
	}
	
	@Override
	public String toString() {
		if(ec == null){
			return "UNKNOWN";
		}
		return ec.getDesc() + (null != causeStr ?  causeStr : "");
	}
}

